﻿# include<stdio.h>

struct node
{
    int data;
    int flag;
};

const long N = 100000;
struct node array[N];
void insert(int root,int key)
{
    if(array[root].flag == 0)
    {
        array[root].data = key;
        array[root].flag = 1;
    }
    else if(key > array[root].data)
        insert(2*root+1,key);
    else if(key < array[root].data)
        insert(2*root,key);
}
int find(int root , int key)
{
    if(array[root].flag == 0 )
        return -1;
    if(key > array[root].data)
        return find(2*root+1,key);
    else if(key < array[root].data)
        return find(2*root,key);
    else if(key == array[root].data)
        return root;
}
void Delete(int root, int key)
{
    int temp = find(root,key);
    if(temp == -1 )
        printf("error\n");
    array[temp].data = 0;
    array[temp].flag = 0;
}
void print(int root)
{
    if(array[root].flag != 0)
    {
        print(2*root);

        printf("%d ",array[root].data);

        print(2*root+1);
    }
}
int main()
{

    int key;
    while(scanf("%d",&key)!=EOF)
        insert(1,key);
    print(1);
    return 0;
}
